﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SilverlightClient
{
    public partial class NotificationCW : ChildWindow
    {
       
        public NotificationCW()
        {
            InitializeComponent();
        }

        public NotificationCW(int id, string content, DateTime modifiedDate)
        {
            InitializeComponent();
            string newContent = content.Substring(0, Math.Min(10,content.Length));
            if (content.Length > 10)
            {
                newContent += "...";
            }
            notifyTextBlock.Text = "New Message was added. With ID " + id + ", Content \"" + newContent + "\", At " + modifiedDate + ".";
        }

        public NotificationCW(int id, string subforumTopic, string content, DateTime modifiedDate)
        {
            InitializeComponent();
            string newContent = content.Substring(0, Math.Min(10, content.Length));
            if (content.Length > 10)
            {
                newContent += "...";
            }
            notifyTextBlock.Text = "Message Edited at sub forum \"" + subforumTopic + "\". With ID " + id + ", New content \"" + newContent + "\", At " + modifiedDate + ".";
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }

        private void ChildWindow_Closed(object sender, EventArgs e)
        {

        }
    }
}

